//实现判断一个字符串是否为回文字
object practise2 {
  def main(args: Array[String]): Unit = {
    println(isPalindrome("racecar")) // true
    println(isPalindrome("hello")) // false
  }
  def isPalindrome(str: String): Boolean = {
    val len = str.length
    val halfLen = len / 2
    for (i <- 0 until halfLen) {
      if (str(i) != str(len - i - 1)) {
        return false
      }
    }
    true
  }

}
